<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>在线商城</title>


<link rel="stylesheet"
	href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<script
	src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script
	src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style type="text/css">
#page {
	position: absolute;
	top: 550px;
}
</style>
<script type="text/javascript">
	function tr(mes){
		//alert(mes);
		//parent.location.href="/user/goodmes?zybgoodid="+mes;
		window.open('/user/goodmes?zybgoodid='+mes);
	}
	
	function logout(){
		
		window.location.href="/logout";
	}
	
	
	
</script>
</head>
<body>
	欢迎${sessionScope.u.zybname}用户登录 <input type="button" value="注销" onclick="logout();"/>


	<div class="container">
		<div class="row clearfix">
			<div class="col-md-12 column">
				<div class="jumbotron well">
					<h3>在线购物系统</h3>
					<p>买买买！</p>

				</div>
				<ul class="breadcrumb">
					<li><a href="#">在线购物系统</a></li>
					<li class="active">商品列表</li>
				</ul>
				<div class="container-fluid">

					<div>
						<form action="/user/searchgood" method="post"
							class="navbar-form navbar-left" role="search">

							<!-- <input type="hidden" name="_method" value="DELETE"/> -->


							<div class="form-group">

								<input type="text" class="form-control" placeholder="Search"
									name="mes">
							</div>
							<input type="submit" class="btn btn-default" value="查看您想要的商品">&nbsp;
							<a href="/cart/cart?zybuserid=${sessionScope.u.zybuserid }"
								class="btn btn-primary">查看购物车</a>
						</form>

					</div>
				</div>
				</nav>
				<table class="table">
					<thead>
						<tr>
							<th>商品编号</th>
							<th>商品名称</th>
							<th>商品单价(￥)</th>
							<th>商品数量</th>
							<th></th>
						</tr>
					</thead>
					<tbody>

						<c:forEach items="${p.list }" var="item">

							<tr >
								<td onclick="tr(${item.zybgoodid });">${item.zybgoodid }</td>
								<td onclick="tr(${item.zybgoodid });">${item.zybgoodname }</td>
								<td onclick="tr(${item.zybgoodid });">${item.zybprice }</td>
								<td onclick="tr(${item.zybgoodid });">${item.zybquantity }</td>
								<td><a
									href="/cart/add?zybgoodid=${item.zybgoodid}&zybuserid=${sessionScope.u.zybuserid}&zybnumber=1">添加至购物车</a></td>

							</tr>
						</c:forEach>
					</tbody>
				</table>
				<!--分页  -->
				<div class="row clearfix" id="page">
					<div class="col-md-12 column">
						<ul class="pagination">
							<li><a>${p.count}条记录/共${p.total }页</a></li>

							<li><c:if test="${p.total <=1}">
									<a href="#" style="disabled: true">上一页</a>
								</c:if> <c:if test="${p.total>=2 }">
									<a href="/user/userpagelist?current=${p.current -1}">上一页</a>
								</c:if></li>

							<c:forEach begin="1" end="${p.total }" step="1" var="index">
								<li><a href="/user/userpagelist?current=${index}">${index}</a></li>
							</c:forEach>
							<li><c:if test="${p.total <=1}">
									<a href="#" style="disabled: true">上一页</a>
								</c:if> <c:if test="${p.total>=2 }">
									<a
										href="/user/userpagelist?current=${p.current +1<=p.total?p.current +1:p.total}">下一页</a>
								</c:if></li>
						</ul>
					</div>
				</div>

			</div>
		</div>
	</div>
</body>
</html>